package cn.edu.ujn.project.supermarket.service.impl;

import java.util.List;

import cn.edu.ujn.project.supermarket.extendbean.SellReportChild;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.edu.ujn.project.common.core.text.Convert;
import cn.edu.ujn.project.supermarket.domain.VipUser;
import cn.edu.ujn.project.supermarket.mapper.VipUserMapper;
import cn.edu.ujn.project.supermarket.service.IVipUserService;

/**
 * vip余额Service业务层处理
 * 
 * @author zhaomh
 * @date 2023-11-13
 */
@Service
public class VipUserServiceImpl implements IVipUserService 
{
    @Autowired
    private VipUserMapper vipUserMapper;

    /**
     * 查询vip余额
     * 
     * @param vipId vip余额主键
     * @return vip余额
     */
    @Override
    public VipUser selectVipUserByVipId(String vipId)
    {
        return vipUserMapper.selectVipUserByVipId(vipId);
    }

    @Override
    public VipUser selectVipUserByUserId(Long userId)
    {
        return vipUserMapper.selectVipUserByUserId(userId);
    }
    /**
     * 查询vip余额列表
     * 
     * @param vipUser vip余额
     * @return vip余额
     */
    @Override
    public List<VipUser> selectVipUserList(VipUser vipUser)
    {
        return vipUserMapper.selectVipUserList(vipUser);
    }

    /**
     * 新增vip余额
     * 
     * @param vipUser vip余额
     * @return 结果
     */
    @Override
    public int insertVipUser(VipUser vipUser)
    {
        return vipUserMapper.insertVipUser(vipUser);
    }

    /**
     * 修改vip余额
     * 
     * @param vipUser vip余额
     * @return 结果
     */
    @Override
    public int updateVipUser(VipUser vipUser)
    {
        return vipUserMapper.updateVipUser(vipUser);
    }

    /**
     * 充值vip余额
     * 
     * @param vipUser vip余额
     * @return 结果
     */
    @Override
    public int vipUserCharge(VipUser vipUser)
    {
        return vipUserMapper.vipUserCharge(vipUser);
    }
    /**
     * 批量删除vip余额
     * 
     * @param vipIds 需要删除的vip余额主键
     * @return 结果
     */
    @Override
    public int deleteVipUserByVipIds(String vipIds)
    {
        return vipUserMapper.deleteVipUserByVipIds(Convert.toStrArray(vipIds));
    }

    /**
     * 删除vip余额信息
     * 
     * @param vipId vip余额主键
     * @return 结果
     */
    @Override
    public int deleteVipUserByVipId(String vipId)
    {
        return vipUserMapper.deleteVipUserByVipId(vipId);
    }

    public List<SellReportChild> selectVipPurchaseRecordList(SellReportChild sellReportChild){
        return this.vipUserMapper.selectVipPurchaseRecordList(sellReportChild);
    }
}
